<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta
			name="viewport"
			content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no"
		/>
		<meta name="format-detection" content="telephone=no" />
		<meta name="format-detection" content="email=no" />
		<meta http-equiv="Pragma" content="no-cache" />
		<meta http-equiv="Cache-Control" content="no-cache" />
		<meta http-equiv="Expires" content="0" />
		<title>常用功能</title>
		<!-- 引入 vant UI 组件库样式文件 -->
		<link rel="stylesheet" href="../common/css/vant-index.css" />
		<link rel="stylesheet" href="./css/menu.css" />
		<style type="text/css"></style>
	</head>

	<body>
		<div id="app" v-cloak>
			<div class="menu">
				<ul class="menuList">
					<li v-if="isPass">
						<img src="./img/menu/message.png" @click="gotoChatroom" /><span
							>新消息</span
						>
					</li>
					<li v-if="isPass">
						<img src="./img/menu/add.png" @click="gotoQrcode" /><span
							>添加患者</span
						>
					</li>
					<li v-if="isPass">
						<img src="./img/menu/service.png" @click="gotoOpc" /><span
							>今日门诊</span
						>
					</li>
					<li v-if="isPass">
						<img src="./img/menu/statistical.png" @click="gotoStat" /><span
							>今日统计</span
						>
					</li>
					<li>
						<img src="./img/menu/science.png" @click="gotoKnowledge" /><span
							>科普文章</span
						>
					</li>
					<li v-if="isPass">
						<img src="./img/menu/flow.png" @click="gotoFlow" /><span
							>收退款</span
						>
					</li>
					<li v-if="isPass">
						<img src="./img/menu/glucometer.png" @click="gotoGluc" /><span
							>领取血糖仪</span
						>
					</li>
					<li>
						<img src="./img/menu/help.png" @click="gotoHelp" /><span
							>帮助与反馈</span
						>
					</li>
					<!-- <li id="launch-btn2"></li> -->
					<!-- <li><img src="./img/menu/tool.png" /><span>工具箱</span></li> -->
				</ul>
			</div>
		</div>
	</body>
	<script src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
	<!-- 引入 rem -->
	<script src="../common/js/rem.js"></script>
	<!-- 上线环境用 -->
	<script src="../common/js/vue.global.prod.js?time=202208131234"></script>
	<!-- 引入 UI 组件库 -->
	<script src="../common/js/vant.min.js"></script>
	<!-- axios 接口调用 -->
	<script src="../common/js/axios.min.js"></script>
	<script src="../base.js"></script>
	<script src="../common/js/url.min.js"></script>
	<script src="../common/js/rem.js"></script>

	<script type="module">
		import {
			getAction,
			postAction,
			spliceUrl,
		} from '../common/js/api/vue3-axios-utils.js'

		import { wechatInit, wx_launch, is_weixn } from './js/wechat1.js'

		const menu = {
			data() {
				return {
					url: {
						doctorIsPass: '/201/02/2010201',
					},
					isPass: false,
					orgCode: '',
				}
			},
			created() {
				this.doctorId = url('?doctorId') || 10011051
				if (!this.doctorId) {
					vant.Toast.fail('数据异常')
					return false
				}
				this.getDoctorStatus()
				wechatInit()
				setTimeout(() => {
					this.gotoSignin()
				}, 500)
			},
			methods: {
				getDoctorStatus() {
					postAction(spliceUrl(this.url.doctorIsPass), {
						doctorId: this.doctorId,
					}).then(res => {
						res = res.data
						if (res.success) {
							if (res.result) {
								this.isPass = res.result.doctorsIsverify == 1
								this.orgCode = res.result.doctorsHospitalId
							}
						} else {
							vant.Toast.fail(res.message)
						}
					})
				},
				gotoSignin() {
					// const content1 = `
					// 	<div>
					// 		<img src="https://h5.test.dtx-tech.com/patient/img/menu/tool.png"/>
					// 		<span>工具箱</span>
					// 	</div>
					// 	<style>
					// 		div {display:flex;justify-content: center;align-items: center;flex-direction: column;font-size: 16px;color: #999999;}
					// 		img {width: 48px;height: 48px;margin-bottom:8px;}
					// 	</style>
					// `
					// let launchParams2 = {
					// 	eleId: 'launch-btn2', // 元素id
					// 	url: 'pages/index/index.html?role=doctor', // 跳转小程序的页面路径
					// 	content: content1, // 自定义的html内容
					// 	appid: 'gh_f8c6c4b4cd8c',
					// }
					// wx_launch(launchParams2)
				},

				gotoChatroom() {
					window.location.href =
						'https://qywechat.dtx-tech.com/chatroom/list?doctorid=' +
						this.doctorId
				},
				gotoQrcode() {
					window.location.href = './qrcode.html?tab=0&id=' + this.doctorId
				},
				gotoOpc() {
					window.location.href = './opc.html?id=' + this.doctorId
				},
				gotoStat() {
					window.location.href = './baseInfo.html?id=' + this.doctorId
				},
				gotoFlow() {
					window.location.href =
						'./receipt.html?id=' + this.doctorId + '&orgCode=' + this.orgCode
				},
				gotoGluc() {
					window.location.href = './glucometer.html?id=' + this.doctorId
				},
				gotoKnowledge() {
					window.location.href = '../dtrd-website/knowledge.html'
				},
				gotoHelp() {
					window.location.href = './faq.html'
				},
			},
		}

		const app = Vue.createApp(menu)

		app.use(vant)

		// 通过 CDN 引入时不会自动注册 Lazyload 组件
		// 可以通过下面的方式手动注册
		app.use(vant.Lazyload)

		// 调用函数组件，弹出一个 Toast
		// vant.Toast("刷新成功");

		app.mount('#app')
	</script>
</html>
